<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>2</title>
	<script src="./lib/vue-2.4.0.js"></script>
	<script src="./lib/vue-router-3.0.1.js"></script>
</head>
<body>
	<div id="app">
         <input type="text" v-model="firstName">+
         <input type="text" v-model="lastName">=
         <input type="text" v-model="fullName">
	</div>

	<script>
        var vm=new Vue({
        	el:'#app',
        	data:{
        		firstName:'',
        		lastName:'',
        		fullName:''
        	},
        	watch:{//监听元素
               'firstName':function(newVal,oldVal) {
               	   console.log(newVal+'---'+oldVal)
               	   this.fullName=newVal+this.lastName;
               },
               'lastName':function(newVal,oldVal){
               	   this.fullName=this.firstName+newVal;
               }
        	}
        });
	</script>
</body>
</html>